package com.shengde.jinwawaforleader.model.myJob.monitoring;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.shengde.jinwawaforleader.R;
import com.shengde.jinwawaforleader.base.BaseActivity;

/**
 * 摄像头授权
 * Created by Administrator on 2016/9/6 0006.
 */
public class MonitoringAccreditActivity extends BaseActivity {
	private static final String TAG = "MonitoringAeditActivity";
	private TextView tv_back;
	private TextView tv_title;
	private int start_time;
	private int end_time;
	private int start_week;
	private int end_week;
	private RelativeLayout rel_openable_parent;
	private RelativeLayout rel_openable_teacher;
	private RelativeLayout rel_open_time;
	private RelativeLayout rel_monit_name;
	private String deviceSerial;


	@Override
	public void onRoot(Bundle savedInstanceState) {
		setContentView(R.layout.monitoring_accredit_activity);
	}

	@Override
	public void initView() {
		tv_back = (TextView) findViewById(R.id.tv_back);
		tv_title = (TextView) findViewById(R.id.tv_title);
		deviceSerial = getIntent().getStringExtra("deviceSerial");
		rel_monit_name = (RelativeLayout) findViewById(R.id.rel_monit_name);
		rel_open_time = (RelativeLayout) findViewById(R.id.rel_open_time);
		rel_openable_parent = (RelativeLayout) findViewById(R.id.rel_openable_parent);
		rel_openable_teacher = (RelativeLayout) findViewById(R.id.rel_openable_teacher);
	}

	@Override
	public void initData() {
		tv_title.setText(getString(R.string.permission_distribution));
		start_time = getIntent().getIntExtra("start_time",1);
		end_time = getIntent().getIntExtra("end_time",1);

		start_week = getIntent().getIntExtra("start_week",1);
		end_week = getIntent().getIntExtra("end_week",1);
	}

	@Override
	public void initListener() {
		tv_back.setOnClickListener(this);
		rel_monit_name.setOnClickListener(this);
		rel_open_time.setOnClickListener(this);
		rel_openable_parent.setOnClickListener(this);
		rel_openable_teacher.setOnClickListener(this);
	}

	@Override
	public void onWidgetClick(View view) {
		switch (view.getId()) {
			case R.id.tv_back:
				finish();
				break;
			case R.id.rel_monit_name:  //摄像头名字设置
				Intent intent = new Intent(this, CameraNameActivity.class);
				intent.putExtra("deviceSerial", deviceSerial);
				startActivity(intent);
				break;
			case R.id.rel_open_time:  //开放时间
				intent = new Intent(MonitoringAccreditActivity.this, OpenTimeActivity.class);
				intent.putExtra("deviceSerial", deviceSerial);
				intent.putExtra("start_time", start_time);
				intent.putExtra("start_week", start_week);
				intent.putExtra("end_time", end_time);
				intent.putExtra("end_week", end_week);
				startActivity(intent);
				break;
			case R.id.rel_openable_parent:  //可观看 家长
				intent = new Intent(MonitoringAccreditActivity.this, ParentPermissionActivity.class);
				intent.putExtra("deviceSerial", deviceSerial);
				startActivity(intent);
				break;
			case R.id.rel_openable_teacher: //可观看老师
				intent = new Intent(MonitoringAccreditActivity.this, TeacherPermissionActivity.class);
				intent.putExtra("deviceSerial", deviceSerial);
				startActivity(intent);
				break;
		}
	}

}

